<?php

session_start();

/**
 * @author Sabine Müller
 * @copyright 2013
 */


include 'nav.inc.php';
include 'dbConn.php';

html_head('Administration - Passwort &auml;ndern');

	if(!isset($_SESSION["username"]) || !isset($_SESSION['set_kenn']) || $_SESSION['set_kenn'] != '1'){
		echo("<div class='content' style='margin-left:350px'>");
	   echo ("Um diese Seite zuzugreifen sind Ihre Rechte nicht ausreichend. <br/>
				Bitte erst <a href='login.php'>einloggen</a>.");
	   exit;
	   echo("</div");
	 }
	else{
		menu();
		echo("<div class='content' style='margin-left:350px'>");
		if (isset($_REQUEST['next_page']))
			$next_page = $_REQUEST['next_page'];
		else
			$next_page = '0';
		echo ("<form name='main' action='".$_SERVER['SCRIPT_NAME']."' method='post'>\n");
		if($next_page == '0'){
			echo("<select name='kennung'>");
			$result = $dbStunden->std_getMA();
			while($ma = mysql_fetch_assoc($result)){
				echo("<option value='".$ma['m_id']."'>".$ma['m_lang']."</option>");
			}
			echo("</select>");

			echo("<input type='submit' value='Benutzer &auml;ndern'>");
			echo"<input type='hidden' name='next_page' value='1' />\n";
		}
		if($next_page == '1'){
			$_SESSION['userid'] = $_POST["kennung"];
				echo("Benutzer gewechselt");
						//should never happen
		}
		echo("</form>");
	}
echo("</div>");
?>
